package com.sky.controller.user;

import com.sky.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("userShopController")
@RequestMapping("/user/shop")
@Slf4j
public class ShopController {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    private final static String key="SHOP:STATUS";

    @GetMapping("/status")
    public Result<Integer> getStatus(){
        String status=  stringRedisTemplate.opsForValue().get(key);
        log.info("获取营业状态:{}",status.equals("1")?"营业中":"打样中");
        return Result.success(Integer.valueOf(status));

    }
}
